/*
 * ScriptableAnalyzerNode.cpp
 *
 *  Created on: Oct 30, 2013
 *      Author: blackpc
 */

#include <scriptable_analyzer/ScriptableAnalyzerNode.h>

ScriptableAnalyzerNode::ScriptableAnalyzerNode()
{
	_scriptHost.start();

	ros::NodeHandle node("~");

	_scriptSubscriber =
			node.subscribe("/scriptable_analyzer/add_script", 0, &ScriptableAnalyzerNode::onScriptMessage, this);
}

ScriptableAnalyzerNode::~ScriptableAnalyzerNode()
{
	_scriptHost.stop();
}

void ScriptableAnalyzerNode::onScriptMessage(
		const std_msgs::String::ConstPtr script)
{
	_scriptHost.addScript(script->data);
}
